from pathlib import Path
import re

daka_dict = {}

pathlist = Path(".").glob('**/*.txt')
for path in pathlist:
     path_in_str = str(path)
     print(f'reading [{path_in_str}] ...')

     with open(path_in_str) as f:
         for line in f:
             match = re.search(r'学号[:：]\s*(\d{3}[a-zA-Z]\d{3})', line, re.IGNORECASE)
             if not match:
                 continue

             no = match.group(1)
             if no in daka_dict:
                 daka_dict[no].add(f)
             else:
                 day_set = set()
                 day_set.add(f)
                 daka_dict[no] = day_set


for k, v in daka_dict.items():
    print('{} 打卡{}天'.format(k, len(v)))
